cc.Class({
    extends: cc.Component,

    properties: {
        star:[cc.Node]
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        for(let i=0;i<this.star.length;i++){
            this.star[i].children[0].active=false
        }
    },

    start () {
        // this.runStar(0)
    },

    runStar(number){
        number=Math.max(1,number);
        for(let i=0;i<number;i++){
            this.scheduleOnce(()=>{
                SoundMgr.playSound('Audio/star')
                this.showStar(this.star[i])
            },0.5*i)
            
        }
    },

    showStar(node){
        node.children[0].active=true
        node.children[0].x=0
        node.children[0].y=0
        node.children[0].scale=1.5
        node.children[0].runAction(
            cc.sequence(
                cc.scaleTo(0.1,2),cc.scaleTo(0.3,1)
            )
        )
           
            
    },
    // update (dt) {},
});
